#根目录下执行：docker build -t cloud-ops/apps/admin  -f Dockerfile .
FROM golang:1.19 AS builder

WORKDIR /tmp/build
ENV GOPROXY https://goproxy.cn
COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags="-s -w" -o /tmp/build/main /tmp/build/cmd


FROM centos

# 定义变量
ENV TZ Asia/Shanghai

WORKDIR /app
COPY --from=builder /tmp/build/main /app/
COPY --from=builder /tmp/build/config/config.yaml /app/config.yaml

CMD ["/app/main","-log.dir","/data/logs/","-conf","/app/config.yaml"]
